// [[ OnflowGenerator Entity UUID: 7387ed68bbb447ebadace82a630d847b ]]
package com.itdct.onflow.system.account.entity

import com.baomidou.mybatisplus.annotation.TableName
import com.itdct.onflow.core.annotation.Column
import com.itdct.onflow.core.annotation.ColumnRelateDict
import com.itdct.onflow.core.annotation.TableDescription
import com.itdct.onflow.core.entity.BaseUserEntity
import java.util.*

/**
 * @author Zhouwx
 * @date 2025/7/22 23:18:46
 * @version 1.0
 * @description 最基础的账户信息，其他用户请使用一对一关联
 */
@TableDescription("系统账户")
@TableName("sys_account")
class SysAccountEntity : BaseUserEntity() {
    @Column(comment = "账户名", nullable = false, unique = true, length = 50, sort = 10, forSelect = true)
    var name = ""

    @Column(comment = "账户UID", nullable = false, unique = true, length = 64, sort = 20)
    var uid = ""

    @Column(comment = "昵称", nullable = false, indexed = true, length = 50, sort = 30)
    var nickName = ""

    @Column(comment = "hash密码", nullable = false, length = 500, sort = 40)
    var password: String? = null

    @Column(comment = "RSA加密密码", nullable = false, length = 500, sort = 41)
    var rsaPassword: String? = null

    @ColumnRelateDict(dictCode = "gender")
    @Column(comment = "性别", nullable = false, length = 1, sort = 50)
    var gender = 10

    @Column(comment = "是否被锁定", nullable = false, defaultValue = "0", sort = 60)
    var locked: Boolean = false

    @Column(comment = "手机号", length = 32, unique = true, sort = 70)
    var mobile: String? = null

    @Column(comment = "邮箱", length = 50, unique = true, sort = 80)
    var email: String? = null

    @Column(comment = "头像", length = 255, sort = 90)
    var avatar: String? = null

    @Column(comment = "国家", length = 20, sort = 100)
    var country: String? = null

    @Column(comment = "省份", length = 20, sort = 110)
    var province: String? = null

    @Column(comment = "城市", length = 20, sort = 120)
    var city: String? = null

    @Column(comment = "地址", length = 255, sort = 130)
    var address: String? = null

    @Column(comment = "生日", sort = 140)
    var birthday: Date? = null

    @Column(comment = "注册日期", sort = 150)
    var registerDate: Date? = null

    @Column(comment = "上次登录日期", sort = 160)
    var lastLoginDate: Date? = null

    @Column(comment = "上次登录IP", length = 20, sort = 170)
    var lastLoginIp: String? = null

    @Column(comment = "本次登录IP地址", length = 20, sort = 180)
    var nowLoginIp: String? = null

    @Column(comment = "本次登录时间", sort = 190)
    var nowLoginDate: Date? = null

    @Column(comment = "登录次数", nullable = false, defaultValue = "0", sort = 200)
    var loginCount = 0

    /**
     * 保留字段，默认0=正常，其余状态用户自己定义
     */
    @Column(comment = "账户状态", nullable = false, defaultValue = "0", sort = 210)
    var status = 0

    @Column(comment = "微信号", length = 64, sort = 220)
    var wx: String? = null

    @Column(comment = "QQ号", length = 32, sort = 230)
    var qq: String? = null

    @Column(comment = "备注信息", length = 2000, sort = 240)
    var remark = ""

    @Column(comment = "账号过期时间", sort = 250)
    var expireTime: Date? = null

    @Column(comment = "锁定开始时间", sort = 260)
    var lockStartTime: Date? = null

    @Column(comment = "锁定结束时间", sort = 270)
    var lockEndTime: Date? = null
}